package yifeng.thread;

public class InterruptedExp {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Thread t = new Thread(new Runnable(){
			@Override
			public void run() {
				try {
					while(!Thread.currentThread().isInterrupted()){
						Thread.sleep(50);
					}
				} catch (InterruptedException e) {
//					System.out.println(Thread.currentThread().isInterrupted());
					e.printStackTrace();
				}
			}
		});
		t.start();
		
		
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		
		System.out.println("main thread interrupt t thread.");
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		t.interrupt();
		
		
		

	}

}
